#COLUMN DATA
#1      rel_ts
#2      ip_id
#3      d_ip
#4      d_ip
#5      s_port
#6      d_port
#7      seq_num
#8      ack_num
#9      win_sz

# This font is the way to go
#set term postscript eps enhanced color solid "Helvetica" 24 # Can change "color" to "monochrome"
set term postscript eps noenhanced color solid "Helvetica" 24 # Can change "color" to "monochrome"

# Move the key to wherever yields the best readability (top/bottom left/right)
#set key bottom right
unset key


########################################################################
file = "rtt_trace"

## The sequence number plot ##
set title sprintf("Seq Plot: %s", file)
set output sprintf("plots/%s_recv_seq_num.eps", file)
set xlabel 'Relative Time (sec)'
set ylabel 'Seq Number'
plot sprintf("data/%s.recv.dat", file) u ($1/1000000):7 every ::2 w li 

## The actual window size plot ##
set title sprintf("Actual Window: %s", file)
set output sprintf("plots/%s_send_win.eps", file)
set xlabel 'Relative Time (sec)'
set ylabel 'Window Size'
plot sprintf("data/%s.send.dat", file) u ($1/1000000):9 every ::2 w li

## The congestion window size plot ##
set title sprintf("Congestion Window: %s", file)
set output sprintf("plots/%s_full_cwnd.eps", file)
set xlabel 'Relative Time (sec)'
set ylabel 'Congestion Window Size'
plot sprintf("data/%s.full.cwnd.dat", file) u ($1/1000000):2 w li

## The unused buffer space plot ##
set title sprintf("Buffer Space: %s", file)
set output sprintf("plots/%s_full_unused_buffer.eps", file)
set xlabel 'Relative Time (sec)'
set ylabel 'Unused Receiver Buffer Space'
plot sprintf("data/%s.full.unused_buffer.dat", file) u ($1/1000000):2 w li

## The transmission rate plot ##
set title sprintf("Transmission Rate: %s", file)
set output sprintf("plots/%s_tx_rate.eps", file)
set xlabel 'Relative Time (sec)'
set ylabel 'Transmission Rate (KB/s)'
plot sprintf("data/%s.full.tx_rate.dat", file) u ($1/1000000):($2/1024) w li

## The RTT plot (not using Karn's algorithm) ##
set title sprintf("RTT: %s", file)
set output sprintf("plots/%s_full_rtt.eps", file)
set xlabel 'Relative Time (sec)'
set ylabel 'Estimated RTT (msec)'
plot sprintf("data/%s.full.rtt.dat", file) u ($1/1000000):($2/1000) w li

########################################################################
file = "comcast_large_out"

## The sequence number plot ##
set title sprintf("Seq Plot: %s", file)
set output sprintf("plots/%s_recv_seq_num.eps", file)
set xlabel 'Relative Time (sec)'
set ylabel 'Seq Number'
plot sprintf("data/%s.recv.dat", file) u ($1/1000000):7 every ::2 w li 

## The actual window size plot ##
set title sprintf("Actual Window: %s", file)
set output sprintf("plots/%s_send_win.eps", file)
set xlabel 'Relative Time (sec)'
set ylabel 'Window Size'
plot sprintf("data/%s.send.dat", file) u ($1/1000000):9 every ::2 w li

## The congestion window size plot ##
set title sprintf("Congestion Window: %s", file)
set output sprintf("plots/%s_full_cwnd.eps", file)
set xlabel 'Relative Time (sec)'
set ylabel 'Congestion Window Size'
plot sprintf("data/%s.full.cwnd.dat", file) u ($1/1000000):2 w li

## The unused buffer space plot ##
set title sprintf("Buffer Space: %s", file)
set output sprintf("plots/%s_full_unused_buffer.eps", file)
set xlabel 'Relative Time (sec)'
set ylabel 'Unused Receiver Buffer Space'
plot sprintf("data/%s.full.unused_buffer.dat", file) u ($1/1000000):2 w li

## The transmission rate plot ##
set title sprintf("Transmission Rate: %s", file)
set output sprintf("plots/%s_tx_rate.eps", file)
set xlabel 'Relative Time (sec)'
set ylabel 'Transmission Rate (KB/s)'
plot sprintf("data/%s.full.tx_rate.dat", file) u ($1/1000000):($2/1024) w li

## The RTT plot (not using Karn's algorithm) ##
set title sprintf("RTT: %s", file)
set output sprintf("plots/%s_full_rtt.eps", file)
set xlabel 'Relative Time (sec)'
set ylabel 'Estimated RTT (msec)'
plot sprintf("data/%s.full.rtt.dat", file) u ($1/1000000):($2/1000) w li

########################################################################
file = "airplane_large_out"

## The sequence number plot ##
set title sprintf("Seq Plot: %s", file)
set output sprintf("plots/%s_recv_seq_num.eps", file)
set xlabel 'Relative Time (sec)'
set ylabel 'Seq Number'
plot sprintf("data/%s.recv.dat", file) u ($1/1000000):7 every ::2 w li 

## The actual window size plot ##
set title sprintf("Actual Window: %s", file)
set output sprintf("plots/%s_send_win.eps", file)
set xlabel 'Relative Time (sec)'
set ylabel 'Window Size'
plot sprintf("data/%s.send.dat", file) u ($1/1000000):9 every ::2 w li

## The congestion window size plot ##
set title sprintf("Congestion Window: %s", file)
set output sprintf("plots/%s_full_cwnd.eps", file)
set xlabel 'Relative Time (sec)'
set ylabel 'Congestion Window Size'
plot sprintf("data/%s.full.cwnd.dat", file) u ($1/1000000):2 w li

## The unused buffer space plot ##
set title sprintf("Buffer Space: %s", file)
set output sprintf("plots/%s_full_unused_buffer.eps", file)
set xlabel 'Relative Time (sec)'
set ylabel 'Unused Receiver Buffer Space'
plot sprintf("data/%s.full.unused_buffer.dat", file) u ($1/1000000):2 w li

## The transmission rate plot ##
set title sprintf("Transmission Rate: %s", file)
set output sprintf("plots/%s_tx_rate.eps", file)
set xlabel 'Relative Time (sec)'
set ylabel 'Transmission Rate (KB/s)'
plot sprintf("data/%s.full.tx_rate.dat", file) u ($1/1000000):($2/1024) w li

## The RTT plot (not using Karn's algorithm) ##
set title sprintf("RTT: %s", file)
set output sprintf("plots/%s_full_rtt.eps", file)
set xlabel 'Relative Time (sec)'
set ylabel 'Estimated RTT (msec)'
plot sprintf("data/%s.full.rtt.dat", file) u ($1/1000000):($2/1000) w li

########################################################################
file = "spr_by_window_large_out"

## The sequence number plot ##
set title sprintf("Seq Plot: %s", file)
set output sprintf("plots/%s_recv_seq_num.eps", file)
set xlabel 'Relative Time (sec)'
set ylabel 'Seq Number'
plot sprintf("data/%s.recv.dat", file) u ($1/1000000):7 every ::2 w li 

## The actual window size plot ##
set title sprintf("Actual Window: %s", file)
set output sprintf("plots/%s_send_win.eps", file)
set xlabel 'Relative Time (sec)'
set ylabel 'Window Size'
plot sprintf("data/%s.send.dat", file) u ($1/1000000):9 every ::2 w li

## The congestion window size plot ##
set title sprintf("Congestion Window: %s", file)
set output sprintf("plots/%s_full_cwnd.eps", file)
set xlabel 'Relative Time (sec)'
set ylabel 'Congestion Window Size'
plot sprintf("data/%s.full.cwnd.dat", file) u ($1/1000000):2 w li

## The unused buffer space plot ##
set title sprintf("Buffer Space: %s", file)
set output sprintf("plots/%s_full_unused_buffer.eps", file)
set xlabel 'Relative Time (sec)'
set ylabel 'Unused Receiver Buffer Space'
plot sprintf("data/%s.full.unused_buffer.dat", file) u ($1/1000000):2 w li

## The transmission rate plot ##
set title sprintf("Transmission Rate: %s", file)
set output sprintf("plots/%s_tx_rate.eps", file)
set xlabel 'Relative Time (sec)'
set ylabel 'Transmission Rate (KB/s)'
plot sprintf("data/%s.full.tx_rate.dat", file) u ($1/1000000):($2/1024) w li

## The RTT plot (not using Karn's algorithm) ##
set title sprintf("RTT: %s", file)
set output sprintf("plots/%s_full_rtt.eps", file)
set xlabel 'Relative Time (sec)'
set ylabel 'Estimated RTT (msec)'
plot sprintf("data/%s.full.rtt.dat", file) u ($1/1000000):($2/1000) w li

########################################################################
file = "spr_desk_large_out"

## The sequence number plot ##
set title sprintf("Seq Plot: %s", file)
set output sprintf("plots/%s_recv_seq_num.eps", file)
set xlabel 'Relative Time (sec)'
set ylabel 'Seq Number'
plot sprintf("data/%s.recv.dat", file) u ($1/1000000):7 every ::2 w li 

## The actual window size plot ##
set title sprintf("Actual Window: %s", file)
set output sprintf("plots/%s_send_win.eps", file)
set xlabel 'Relative Time (sec)'
set ylabel 'Window Size'
plot sprintf("data/%s.send.dat", file) u ($1/1000000):9 every ::2 w li

## The congestion window size plot ##
set title sprintf("Congestion Window: %s", file)
set output sprintf("plots/%s_full_cwnd.eps", file)
set xlabel 'Relative Time (sec)'
set ylabel 'Congestion Window Size'
plot sprintf("data/%s.full.cwnd.dat", file) u ($1/1000000):2 w li

## The unused buffer space plot ##
set title sprintf("Buffer Space: %s", file)
set output sprintf("plots/%s_full_unused_buffer.eps", file)
set xlabel 'Relative Time (sec)'
set ylabel 'Unused Receiver Buffer Space'
plot sprintf("data/%s.full.unused_buffer.dat", file) u ($1/1000000):2 w li

## The transmission rate plot ##
set title sprintf("Transmission Rate: %s", file)
set output sprintf("plots/%s_tx_rate.eps", file)
set xlabel 'Relative Time (sec)'
set ylabel 'Transmission Rate (KB/s)'
plot sprintf("data/%s.full.tx_rate.dat", file) u ($1/1000000):($2/1024) w li

## The RTT plot (not using Karn's algorithm) ##
set title sprintf("RTT: %s", file)
set output sprintf("plots/%s_full_rtt.eps", file)
set xlabel 'Relative Time (sec)'
set ylabel 'Estimated RTT (msec)'
plot sprintf("data/%s.full.rtt.dat", file) u ($1/1000000):($2/1000) w li

########################################################################
file = "vzw_desk_large_out"

## The sequence number plot ##
set title sprintf("Seq Plot: %s", file)
set output sprintf("plots/%s_recv_seq_num.eps", file)
set xlabel 'Relative Time (sec)'
set ylabel 'Seq Number'
plot sprintf("data/%s.recv.dat", file) u ($1/1000000):7 every ::2 w li 

## The actual window size plot ##
set title sprintf("Actual Window: %s", file)
set output sprintf("plots/%s_send_win.eps", file)
set xlabel 'Relative Time (sec)'
set ylabel 'Window Size'
plot sprintf("data/%s.send.dat", file) u ($1/1000000):9 every ::2 w li

## The congestion window size plot ##
set title sprintf("Congestion Window: %s", file)
set output sprintf("plots/%s_full_cwnd.eps", file)
set xlabel 'Relative Time (sec)'
set ylabel 'Congestion Window Size'
plot sprintf("data/%s.full.cwnd.dat", file) u ($1/1000000):2 w li

## The unused buffer space plot ##
set title sprintf("Buffer Space: %s", file)
set output sprintf("plots/%s_full_unused_buffer.eps", file)
set xlabel 'Relative Time (sec)'
set ylabel 'Unused Receiver Buffer Space'
plot sprintf("data/%s.full.unused_buffer.dat", file) u ($1/1000000):2 w li

## The transmission rate plot ##
set title sprintf("Transmission Rate: %s", file)
set output sprintf("plots/%s_tx_rate.eps", file)
set xlabel 'Relative Time (sec)'
set ylabel 'Transmission Rate (KB/s)'
plot sprintf("data/%s.full.tx_rate.dat", file) u ($1/1000000):($2/1024) w li

## The RTT plot (not using Karn's algorithm) ##
set title sprintf("RTT: %s", file)
set output sprintf("plots/%s_full_rtt.eps", file)
set xlabel 'Relative Time (sec)'
set ylabel 'Estimated RTT (msec)'
plot sprintf("data/%s.full.rtt.dat", file) u ($1/1000000):($2/1000) w li

########################################################################
